Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Rotate Catalyst Servers to Retry #127

Merged
merged 7 commits into from
Nov 18, 2024

Conversation

kevinszuchet
Copy link
Contributor

No description provided.

Copy link
Collaborator

@aleortega aleortega left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM to me so far, it is nice to have the retry mechanism at queue level almost ready, we can see if this rotation of Catalyst fixes the edge cases we are having, otherwise we can go further and finish implementing the retry at queue level or the DLQ as we discussed.

Great work, thanks!

: contentClient

return retry(() => contentClientToUse.fetchEntityById(entityId), retries, waitTime)
function getContentClientOrDefault(contentServerUrl?: string): ContentClient {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This use case will be very common, we can live with it for now but I think the best thing to do on these cases is to expose a function in catalyst-client's contentClient and lambdaClient like:

function setCatalyst(url: string): void

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -43,10 +41,10 @@ export async function createEventParser({
}

async function parseCatalystEvent(event: any): Promise<CatalystDeploymentEvent | undefined> {
const contentUrl = event.contentServerUrls ? event.contentServerUrls[0] : loadBalancer
const { contentServerUrls } = event
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this be always populated? maybe we can have a fallback just in case

const results = await Promise.all(asyncResults)

const badgesToGrant = results.filter(({ ok, result }) => ok && !!result).map(({ result }) => result)
const handlersToRetry = results.filter(({ ok }) => !ok)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would keep it for now but add an underscore so we by-pass the lint warning

Suggested change
const handlersToRetry = results.filter(({ ok }) => !ok)
const _handlersToRetry = results.filter(({ ok }) => !ok)

@@ -127,6 +127,12 @@ export class ParsingEventError extends Error {
}
}

export type EventHandlerResponse = {
ok: boolean
result?: any
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the ObserverResponse, right? I'd name like that and may can we join result and error? so result can be either a correct answer (Badge I think) or a Error type

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WDYT about naming it EventProcessingResult? I think this name better reflects the overall outcome of processing an event and aligns more closely with its intended function.

What benefits would we gain by combining both the result and the error? I prefer to keep them separated.

@kevinszuchet kevinszuchet marked this pull request as ready for review November 15, 2024 14:35
@kevinszuchet kevinszuchet merged commit d27b71c into main Nov 18, 2024
6 checks passed
@kevinszuchet kevinszuchet deleted the feat/rotate-catalyst-servers-to-retry branch November 18, 2024 14:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants